# Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=tinycdb
pkgver=0.78
pkgrel=3
pkgdesc='Very fast and simple package for creating and reading constant data bases'
url='http://www.corpit.ru/mjt/tinycdb.html'
license=('custom')
arch=('x86_64')
source=("http://www.corpit.ru/mjt/tinycdb/${pkgname}-${pkgver}.tar.gz")
sha256sums=('50678f432d8ada8d69f728ec11c3140e151813a7847cf30a62d86f3a720ed63c')

prepare() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	sed -e 's/all: static/all: shared/' -e '/libcdb.a/d' -i Makefile
}

build() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	make CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
}

package() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	make DESTDIR="${pkgdir}" prefix=/usr mandir=/usr/share/man \
		INSTALLPROG=cdb-shared install-{all,sharedlib}
	install -Dm644 debian/copyright "${pkgdir}"/usr/share/licenses/tinycdb/copyright
}
